function L = BetaTruncatedLikelihood(x, rIndex, rStock, limit)
%     x(1)=theta(1);%beta
%     x(2)=theta(2);%sigma
    [nn ~] = size(rStock);
    lu = limit; ld = -limit;
    %;
%     x
    
    n1  = normpdf((rStock - rIndex .* x(1))./sqrt(x(2)), 0, 1);
    nn1 = normcdf((lu   - rIndex .* x(1))./sqrt(x(2)), 0, 1);
    nn2 = normcdf((ld   - rIndex .* x(1))./sqrt(x(2)), 0, 1);
    L = sum(log(n1./((nn1 - nn2).*sqrt(x(2)))));
end